import base64

a3 = 'MbT3sQgX039i3g==AQOoMQFPskB1Bsc7'

v5 = bytearray(a3, 'utf-8')
v12 = bytearray(32)
length = len(v5)
if length == 32:
    for i in range(16):
        v12[i] = v5[i + 16]
        v12[i + 16] = v5[i]
print("v12=" + v12.decode("utf-8"))
v9 = 0
while v9 < 31:
    v13 = v12[v9]
    v12[v9] = v12[v9 + 1]
    v12[v9 + 1] = v13
    v9 += 2
result = v12.decode('utf-8')
print("result=" + result)

# 新base64映射码
new = "i5jLW7S0GX6uf1cv3ny4q8es2Q+bdkYgKOIT/tAxUrFlVPzhmow9BHCMDpEaJRZN"
# 旧base64映射码
ori = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

change = result.translate(str.maketrans(new, ori))
print("after changing:" + change)
print(base64.b64decode(change))

# 正向： input -> base64加密 -> 前后16位交换 -> 两两交换 -> MbT3sQgX039i3g==AQOoMQFPskB1Bsc7
# 逆向： MbT3sQgX039i3g==AQOoMQFPskB1Bsc7 -> 两两交换 -> 前后16位交换 -> base64解密 -> input
# 因为是32位偶数的关系，两两交换和前后16位交换顺序没多大关系
